package cn.ly817.jay.enums;

/**
 * Created by LuoYu on 2016/12/12.
 */
public enum WeekdayName {
    SUN(1,"星期天"),
    MON(2,"星期一"),
    TUE(3,"星期二"),
    WED(4,"星期三"),
    THU(5,"星期四"),
    FRI(6,"星期五"),
    SAT(7,"星期六");
    private int weekIndex;

    private String dayName;

    WeekdayName(int weekIndex, String dayName) {
        this.weekIndex = weekIndex;
        this.dayName = dayName;
    }

    public int getWeekIndex() {
        return weekIndex;
    }

    public void setWeekIndex(int weekIndex) {
        this.weekIndex = weekIndex;
    }

    public String getDayName() {
        return dayName;
    }

    public void setDayName(String dayName) {
        this.dayName = dayName;
    }

    public static String nameOfIndex(int weekIndex){
        for(WeekdayName state : values()){
            if (state.getWeekIndex() == weekIndex)
                return state.getDayName();
        }
        return null;
    }
}

